package internal

import(
	"context"

	"gogf/gf/os/gcfg"
	gogfFbyFbsDb "gogf/fby/fbs/db"
)

var projectSid string

func init(){
	ctx := context.Background()
	initSetDb(ctx)
	initProjectSid(ctx)
}

func initProjectSid(ctx context.Context) {
	cfgVal2, err := gcfg.Instance("fpy").Get(ctx, "projectSid", "")
	if err != nil {
		panic("未设置配置文件/config/fpy.yaml")
	}
	projectSid = cfgVal2.(string)
}


func initSetDb(ctx context.Context) {
	cfgVal2, err := gcfg.Instance("fby-pgsql").Get(ctx, "dbUrlArr")
	if err != nil {
		panic("未设置配置文件/config/fby-pgsql.yaml")
	}
	dbUrlArr2 := cfgVal2.([]any)
	var dbUrlArr []string
	for _, item := range dbUrlArr2 {
		dbUrlArr = append(dbUrlArr, item.(string))
	}
	gogfFbyFbsDb.SetDbUrlArr(dbUrlArr)
	gogfFbyFbsDb.SetDbSid("{{DbSid}}")
}